package com.uusee.shipshape.zq.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.uusee.shipshape.gt.model.SourceSite;

@Entity
@Table(name = "ss_zq_upload_user_reg")
@SuppressWarnings("serial")
public class UploadUserReg implements Serializable {
	@Id
	@Column(name = "page_code")
	private String pageCode;

	@Column(name = "source_site")
	private String sourceSite;

	@Column(name = "page_name")
	private String pageName;

	@Column(name = "page_encoder")
	private String pageEncoder;

	@Column(name = "page_must_tag")
	private String pageMustTag;

	@Column(name = "page_front_filter_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String pageFrontFilterReg;

	@Column(name = "page_back_filter_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String pageBackFilterReg;

	@Column(name = "user_count_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userCountReg;

	@Column(name = "user_page_count_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userPageCountReg;

	@Column(name = "user_list_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userListReg;

	@Column(name = "user_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userReg;

	@Column(name = "user_id_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userIdReg;

	@Column(name = "username_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String usernameReg;

	@Column(name = "logo_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String logoReg;

	@Column(name = "user_blog_url_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String userBlogUrlReg;

	@Column(name = "da_reg_type_reg")
	@Type(type = "org.springframework.orm.hibernate3.support.ClobStringType")
	private String daRenTypeReg;

	@Column(name = "update_user")
	private String updateUser;

	@Column(name = "update_date")
	private Date updateDate;

	public String getPageCode() {
		return pageCode;
	}

	public void setPageCode(String pageCode) {
		this.pageCode = pageCode;
	}

	public String getSourceSite() {
		return sourceSite;
	}

	public void setSourceSite(String sourceSite) {
		this.sourceSite = sourceSite;
	}

	public String getPageName() {
		return pageName;
	}

	public void setPageName(String pageName) {
		this.pageName = pageName;
	}

	public String getPageEncoder() {
		return pageEncoder;
	}

	public void setPageEncoder(String pageEncoder) {
		this.pageEncoder = pageEncoder;
	}

	public String getPageMustTag() {
		return pageMustTag;
	}

	public void setPageMustTag(String pageMustTag) {
		this.pageMustTag = pageMustTag;
	}

	public String getPageFrontFilterReg() {
		return pageFrontFilterReg;
	}

	public void setPageFrontFilterReg(String pageFrontFilterReg) {
		this.pageFrontFilterReg = pageFrontFilterReg;
	}

	public String getPageBackFilterReg() {
		return pageBackFilterReg;
	}

	public void setPageBackFilterReg(String pageBackFilterReg) {
		this.pageBackFilterReg = pageBackFilterReg;
	}

	public String getUserCountReg() {
		return userCountReg;
	}

	public void setUserCountReg(String userCountReg) {
		this.userCountReg = userCountReg;
	}

	public String getUserPageCountReg() {
		return userPageCountReg;
	}

	public void setUserPageCountReg(String userPageCountReg) {
		this.userPageCountReg = userPageCountReg;
	}

	public String getUserListReg() {
		return userListReg;
	}

	public void setUserListReg(String userListReg) {
		this.userListReg = userListReg;
	}

	public String getUserReg() {
		return userReg;
	}

	public void setUserReg(String userReg) {
		this.userReg = userReg;
	}

	public String getUserIdReg() {
		return userIdReg;
	}

	public void setUserIdReg(String userIdReg) {
		this.userIdReg = userIdReg;
	}

	public String getUsernameReg() {
		return usernameReg;
	}

	public void setUsernameReg(String usernameReg) {
		this.usernameReg = usernameReg;
	}

	public String getLogoReg() {
		return logoReg;
	}

	public void setLogoReg(String logoReg) {
		this.logoReg = logoReg;
	}

	public String getUserBlogUrlReg() {
		return userBlogUrlReg;
	}

	public void setUserBlogUrlReg(String userBlogUrlReg) {
		this.userBlogUrlReg = userBlogUrlReg;
	}

	public String getDaRenTypeReg() {
		return daRenTypeReg;
	}

	public void setDaRenTypeReg(String daRenTypeReg) {
		this.daRenTypeReg = daRenTypeReg;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pageCode == null) ? 0 : pageCode.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UploadUserReg other = (UploadUserReg) obj;
		if (pageCode == null) {
			if (other.pageCode != null)
				return false;
		} else if (!pageCode.equals(other.pageCode))
			return false;
		return true;
	}
	
	public static UploadUserReg getYoukuDaRenList(){
		SourceSite sourceSite = new SourceSite();
		sourceSite.setSiteCode("youku");
		 
		 UploadUserReg uploadUserReg = new UploadUserReg();
		 uploadUserReg.setSourceSite("www.youku.com");
		 uploadUserReg.setPageCode("YOUKU_DAREN_LIST");
		 uploadUserReg.setPageName("空间达人列表页");
		 uploadUserReg.setPageEncoder("UTF-8");
		 uploadUserReg.setPageMustTag("");
		 uploadUserReg.setPageFrontFilterReg(".*<div class=\"s_main\">");
		 uploadUserReg.setPageBackFilterReg("<div class=\"s_footer\">.*");
		 uploadUserReg.setUserPageCountReg("");
		 uploadUserReg.setUserListReg("<div class=\"doyenData\">(.*?)</div><!--userColl end-->");
		 uploadUserReg.setUserReg("<ul class=\"userInfo\">(.*?)</ul>");
		 uploadUserReg.setUserIdReg("<li class=\"userHead\"><a href=\"http://u.youku.com/user_show/id_(.*?)\\.html\".*?>.*?</a></li>");
		 uploadUserReg.setUsernameReg("<li class=\"userName\"><a.*?>(.*?)</a>.*?</li>");
		 uploadUserReg.setLogoReg("<li class=\"userHead\"><a.*?><img.*?src=\"(.*?)\".*?/></a></li>");
		 uploadUserReg.setUserBlogUrlReg("<li class=\"userHead\"><a href=\"(.*?)\".*?>.*?</a></li>");
		 uploadUserReg.setDaRenTypeReg("<li class=\"userName\"><a.*?>.*?</a> <a.*?><img.*?alt=\"(.*?)达人\".*?></a></li>"); 
		 uploadUserReg.setUpdateUser("wangrui");
		 uploadUserReg.setUpdateDate(new Date());
		 
		 return uploadUserReg;
	}
	
	public static UploadUserReg getYoukuUserList(){
		SourceSite sourceSite = new SourceSite();
		sourceSite.setSiteCode("youku");
		UploadUserReg uploadUserReg = new UploadUserReg();
		uploadUserReg.setSourceSite("www.youku.com");
		uploadUserReg.setPageCode("youku_user_list");
		uploadUserReg.setPageName("优酷用户列表页");
		uploadUserReg.setPageEncoder("UTF-8");
		uploadUserReg.setPageMustTag("");
		uploadUserReg.setPageFrontFilterReg(".*<div class=\"s_main.*?\">");
		uploadUserReg.setPageBackFilterReg("<div class=\"s_footer\">.*");
		uploadUserReg.setUserPageCountReg("");
		uploadUserReg.setUserListReg("<div class=\"userTop100\">.*?<div class=\"users\">(.*?)</div><!--users end-->"); 
		uploadUserReg.setUserReg("<ul class=\"userInfo\">(.*?)</ul>");
		uploadUserReg.setUserIdReg("<li class=\"userHead\"><a href=\"http://u.youku.com/user_show/id_(.*?)\\.html\".*?>.*?</a></li>");
		uploadUserReg.setUsernameReg("<li class=\"userName\"><a.*?>(.*?)</a>.*?</li>");
		uploadUserReg.setLogoReg("<li class=\"userHead\"><a.*?><img.*?src=\"(.*?)\".*?/></a></li>");
		uploadUserReg.setUserBlogUrlReg("<li class=\"userHead\"><a href=\"(.*?)\".*?>.*?</a></li>");
		uploadUserReg.setDaRenTypeReg("<li class=\"userName\"><a.*?>.*?</a> <a.*?><img.*?alt=\"(.*?)达人\".*?></a></li>"); 
		uploadUserReg.setUpdateUser("wangrui");
		uploadUserReg.setUpdateDate(new Date());
		return uploadUserReg;
	}

	public static void main(String[] arg) {
		/*
		 * SourceSite tudou = inputMovieBo.getById(SourceSite.class, "tudou");
		 * UploadUserReg uploadUserReg3 = new UploadUserReg();
		 * uploadUserReg3.setSourceSite(tudou);
		 * uploadUserReg3.setPageCode("TUDOU_USER_LIST");
		 * uploadUserReg3.setPageName("用户列表页");
		 * uploadUserReg3.setPageEncoder("gbk");
		 * uploadUserReg3.setPageMustTag("");
		 * uploadUserReg3.setPageFrontFilterReg("");
		 * uploadUserReg3.setPageBackFilterReg("");
		 * uploadUserReg3.setUserPageCountReg("");
		 * uploadUserReg3.setUserListReg(
		 * "<div class=\"single\">(.*?)</div><!--end single -->");
		 * uploadUserReg3
		 * .setUserReg("<div class=\"pack\" >(.*?)</ul>.*?</div>");
		 * uploadUserReg3
		 * .setUserIdReg("<a href=\"/home/.*?php.userID=([0-9]+?)\">");
		 * uploadUserReg3.setUsernameReg(
		 * "<a.*?class=\"pack_userName\">.*?<img.*?alt=\"(.*?)\".*?class=\"pack_userImg\" />.*?</a>"
		 * );uploadUserReg3.setLogoReg(
		 * "<a.*?class=\"pack_userName\">.*?<img src=\"(.*?)\".*?class=\"pack_userImg\" />.*?</a>"
		 * );uploadUserReg3.setUserBlogUrlReg(
		 * "<a href=\"(.*?)\".*?class=\"pack_userName\">.*?<img.*?class=\"pack_userImg\" />.*?</a>"
		 * ); uploadUserReg3.setDaRenReg("");
		 * uploadUserReg3.setUpdateUser("wangrui");
		 * uploadUserReg3.setUpdateDate(new Date());
		 * //inputMovieBo.doSave(uploadUserReg3); uploadUserReg3 =
		 * inputMovieBo.getById(UploadUserReg.class, 3L);
		 * uploadUserReg3.setUserIdReg
		 * ("<a href=\"/home/.*?php.userID=([0-9]+?)\">");
		 * inputMovieBo.doUpdate(uploadUserReg3);
		 */
	}
}
